/*
 * @(#)SourceForgeInstructor.java   09/10/26
 *
 * Copyright (c) 2009 HKUST. All rights reserved.
 *
 */



package org.ust.downloader;

//~--- non-JDK imports --------------------------------------------------------

import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

//~--- JDK imports ------------------------------------------------------------

import java.util.Vector;

/**
 * Interface description
 *
 *
 * @version 0.1, 09/10/26
 * @author Nelson LAU
 */
public interface BrowseInstructions
{
	/**
	 * As a reference to initial next page link value, which is compared with
	 * a updated next page link variable.
	 */
	final static String	NEXT_LINK_DEFAULT_VALUE	= "deliberately instantiated";

	/**
	 * Predict the final download link of a project file
	 * using the specified file link.
	 *
	 * @param fileLink
	 *
	 * @return a link for downloading the specified file
	 */
	public String predictDownloadLink(String fileLink);

	/**
	 * Analyze string comprising the project links from
	 * downloader.SourceForgeNavigator.visitProjectsList(Browser). Then split
	 * the string into several strings each representing one project link.
	 *
	 * @param projectLinks
	 *
	 * @return a vector containing project homepage links
	 */
	public Vector<String> analyzeProjectLinks(String projectLinks);

	/**
	 * Retrieve the latest file link in the form of string
	 * subject to the specified browser is in the page manifesting project files
	 * of different version.
	 * Analyse the latest file using javascript dom library.
	 *
	 *
	 * @return a link to retrieve the latest file
	 */
	public String analyzeNewestFile();

	/**
	 * Visit the page manifesting various project links which
	 * constitute a final string to be returned.
	 * Analyse project list page using javascript dom library.
	 *
	 *
	 * @return a string comprising a number of project links, separated by '\n'
	 */
	public String analyzeProjectsList();

	/**
	 * Retrieve the link to the page with project files to
	 * download, subject to the browser surfing the project homepage.
	 * Analyse file page using javascript dom library.
	 *
	 * @return a link to file page of each project
	 */
	public String analyzeFilePage();

	/**
	 * Look for the link of the next button in list page using javascript dom library.
	 *
	 *
	 * @return next page's link
	 *
	 */
	public String lookForNextPageLink();

	/**
	 * Actions after begining navigation routine, invoked by Navigator class.
	 */
	public void postBeginAction();

	/**
	 * Actions before begining navigation routine, invoked by Navigator class.
	 */
	public void preBeginAction();

	/**
	 * Return the initialProjectListUrl.
	 *
	 * @return initialProjectListUrl
	 */
	public String getInitialProjectListUrl();

	/**
	 * Set the initialProjectListUrl.
	 *
	 * @param initialProjectListUrl
	 */
	public void setInitialProjectListUrl(String initialProjectListUrl);

	/**
	 *
	 *
	 * @param targetUrl
	 * @param projectListBrowser
	 * @param shell
	 * @param display
	 */
	public void duringNavigateProjectList(String targetUrl,
			Browser projectListBrowser, Shell shell, Display display);

	/**
	 *
	 *
	 * @param targetUrl
	 * @param projectListBrowser
	 * @param shell
	 * @param display
	 */
	public void postNavigateProjectList(String targetUrl,
			Browser projectListBrowser, Shell shell, Display display);

	/**
	 *
	 *
	 * @param targetUrl
	 * @param projectListBrowser
	 * @param shell
	 * @param display
	 */
	public void preNavigateProjectList(String targetUrl,
									   Browser projectListBrowser, Shell shell,
									   Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void preNavigateProjectHomepage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void duringNavigateProjectHomepage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void postNavigateProjectHomepage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void duringNavigateProjectFilePage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void postNavigateProjectFilePage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param eachProjectLink
	 * @param fileBrowser
	 * @param fileShell
	 * @param display
	 */
	public void preNavigateProjectFilePage(String eachProjectLink,
			Browser fileBrowser, Shell fileShell, Display display);

	/**
	 *
	 *
	 * @param downloadLatestFile
	 */
	public void preDownloadFile(String downloadLatestFile);

	/**
	 *
	 *
	 * @param downloadLatestFile
	 */
	public void postDownloadFile(String downloadLatestFile);

	/**
	 *
	 *
	 * @param downloadFolderName
	 *
	 */
	public void setDownloadFolderName(String downloadFolderName);

	/**
	 *
	 *
	 * @return
	 */
	public String getDownloadFolderName();
}
